import java.awt.*;
import java.util.Scanner;

public class homework_3 {
    public static void main(String[] args) {
        Picture Julia = new Picture(1024, 1024);
        Scanner input=new Scanner(System.in);
        System.out.print("请输入c的值：");
        Complex c = new Complex(input.nextDouble(),input.nextDouble());
        for(int col=0;col<1024;col++){
            for (int row=0;row<1024;row++){
                Julia.setColor(col,row,check(row,col,c));
            }
        }
        Julia.show();
    }
    public static Color check(int row, int col, Complex c){
        Complex z=new Complex((double) col /256-2, (double) row /(-256)+2);
        int max = 255;
        for(int t=0;t<max;t++){
            if(z.abs()>2){
                Color color=new Color(t,t,t);
                return color;
            }
            z=z.multiply(z).add(c);
        }
        Color color=new Color(max,max,max);
        return color;
    }
}
